import redis
import logging

class Config(object):

    """工程配置信息"""
    DEBUG = True

    SECRET_KEY = "jMZ7Uzw04uor/YU0TPNKu3c3wVe7tmZxHtVj+P1WppDKwICRcZPK+bwH5ecbG1MI"

    #数据库的配置信息
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    #在请求结束时,如果指定此配置为true,那么 SQLAlchemy会自动执行一次 db.session.commit
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    #配置redis
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    #flask_session的配置信息
    SESSION_TYPE = "redis"#指定session保存到redistribute中
    SESSION_USE_SIGNER = True#让cookie中的session_id被加密签名处理
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)#使用redis的实例
    PERMANENT_SESSION_LIFETIME = 86400*2#session的有效期，单位是秒
    LOG_LEVEL = logging.DEBUG



class DevelopmentConfig(Config):
    """开发环境下的配置"""
    DEBUG = True


class ProductionConfig(Config):
    """生产环境下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING

class TestingConfig(Config):
    DEBUG = True
    TESTING = True

config = {
    "development":DevelopmentConfig,
    "production":ProductionConfig,
    "testing":TestingConfig

}



















